<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增App基础信息</title>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript">
	$(function() {
		$("#categoryLevel1").change(function() {
			$.getJSON("categoryLevel2", {
				categoryLevel1 : $("#categoryLevel1").val()
			}, function(data) {
				var html = "<option value='0'>--请选择--</option>";
				$.each(data, function(i, item) {
					html += "<option value='"+item["id"]+"'>";
					html += item["categoryName"];
					html += "</option>";
				})
				$("#categoryLevel2").html(html);
				$("#categoryLevel3").html("");
			})
		})

		$("#categoryLevel2").change(function() {
			$.getJSON("categoryLevel3", {
				categoryLevel2 : $("#categoryLevel2").val()
			}, function(data) {
				var html = "<option value='0'>--请选择--</option>";
				$.each(data, function(i, item) {
					html += "<option value='"+item["id"]+"'>";
					html += item["categoryName"];
					html += "</option>";
				})
				$("#categoryLevel3").html(html);

			})
		})

	})
	function checkAdd() {
		if ($("#softwareName").val() == "") {
			alert("软件名称不能为空")
			return false;
		}
		if ($("#APKName").val() == "") {
			alert("APK名称不能为空")
			return false;
		}
		if ($("#supportROM").val() == "") {
			alert("支持ROM不能为空")
			return false;
		}
		if ($("#interfaceLanguage").val() == "") {
			alert("界面语言不能为空")
			return false;
		}
		if ($("#softwareSize").val() == "") {
			alert("软件大小不能为空")
			return false;
		}
		if ($("#downloads").val() == "") {
			alert("下载次数不能为空")
			return false;
		}
		if ($("#flatformId").val() == "--请选择--") {
			alert("所属平台不能为空")
			return false;
		}
		if ($("#categoryLevel1").val() == "--请选择--") {
			alert("一级分类不能为空")
			return false;
		}
		if ($("#categoryLevel2").val() == "--请选择--") {
			alert("二级分类不能为空")
			return false;
		}
		if ($("#categoryLevel3").val() == "--请选择--") {
			alert("三级分类不能为空")
			return false;
		}
		if ($("#appInfo").html() == "") {
			alert("软件信息不能为空")
			return false;
		}
		if ($("#logoPicPath").val() == "") {
			alert("软件路径不能为空")
			return false;
		}

		return true;
	}
</script>
</head>
<body>
	<h3>新增APP基础信息</h3>

	<form action="update">
		<table>
			<tr>
				<td>软件名称：<input type="hidden" value="${updateAppInfo.id }" name="id"></td>
				<td><input placeholder="请输入软件名称" style="width: 350px"
					type="text" id="softwareName" name="softwareName"
					value="${updateAppInfo.softwareName }" /></td>
			</tr>
			<tr>
				<td>APK名称：</td>
				<td><input placeholder="请输入APK名称" style="width: 350px"
					type="text" id="APKName" name="APKName"
					value="${updateAppInfo.APKName }" /></td>
			</tr>
			<tr>
				<td>支持ROM：</td>
				<td><input placeholder="请输入支持的ROM" style="width: 350px"
					type="text" id="supportROM" name="supportROM"
					value="${updateAppInfo.supportROM }" /></td>
			</tr>
			<tr>
				<td>界面语言：</td>
				<td><input placeholder="请输入软件支持的界面语言" style="width: 350px"
					type="text" id="interfaceLanguage" name="interfaceLanguage"
					value="${updateAppInfo.interfaceLanguage }" /></td>
			</tr>
			<tr>
				<td>软件大小：</td>
				<td><input placeholder="请输入软件大小，单位为MB" style="width: 350px"
					type="text" id="softwareSize" name="softwareSize"
					value="${updateAppInfo.softwareSize }" /></td>
			</tr>
			<tr>
				<td>下载次数：</td>
				<td><input placeholder="请输入下载次数" style="width: 350px"
					type="text" id="downloads" name="downloads"
					value="${updateAppInfo.downloads }" /></td>
			</tr>
			<tr>
				<td>所属平台：</td>
				<td><select style="width: 350px" id="flatformId"
					name="flatformId">
						<option value="${updateAppInfo.flatformId }">${updateAppInfo.flatformName }</option>
						<option value="1">手机</option>
						<option value="2">平板</option>
						<option value="3">通过</option>
				</select></td>
			</tr>
			<tr>
				<td>一级分类：</td>
				<td><select style="width: 350px" id="categoryLevel1"
					name="categoryLevel1">
						<option value="${updateAppInfo.categoryLevel1 }">${updateAppInfo.categoryLevel1Name }</option>
						<option value="1">全部应用</option>
						<option value="2">全部游戏</option>
				</select></td>
			</tr>
			<tr>
				<td>二级分类：</td>
				<td><select style="width: 350px" id="categoryLevel2"
					name="categoryLevel2">
						<option value="${updateAppInfo.categoryLevel2 }">${updateAppInfo.categoryLevel2Name }</option>
				</select></td>
			</tr>
			<tr>
				<td>三级分类：</td>
				<td><select style="width: 350px" id="categoryLevel3"
					name="categoryLevel3">
						<option value="${updateAppInfo.categoryLevel3 }">${updateAppInfo.categoryLevel3Name }</option>
				</select></td>
			</tr>
			<tr>
				<td>APP状态：</td>
				<td><input type="text" value="${updateAppInfo.statusName }"></td>
			</tr>
			<tr>
				<td>应用简介：</td>
				<td><textarea rows="3" cols="9"
						placeholder="请输入本软件的相关信息，本信息作为软件的详细信息进行软件的介绍"
						style="width: 350px; overflow: hidden" id="appInfo" name="appInfo">
		         ${updateAppInfo.appInfo }
		      </textarea></td>
			</tr>
			<tr>
				<td>LOGO图片:</td>
				<td><img src="  ${updateAppInfo.logoPicPath }" width="180px" /><br />
					<input style="width: 350px" type="file" id="logoPicPath"
					name="logoPicPath" /></td>
			</tr>
			<tr>
				<td><br /> <input style="background-color: orange"
					type="submit" value="保存" /> <input type="button" value="返回"
					id="return" onclick="window.location.href('index')" /></td>
			</tr>
		</table>
	</form>

</body>
</html>